import org.sparkle.html.impl.basic.Button;
import org.sparkle.html.impl.basic.Div;
import org.sparkle.html.impl.basic.Form.CustomFormBean;
import org.sparkle.html.impl.basic.Head;
import org.sparkle.html.impl.basic.Head.DefaultScript;
import org.sparkle.html.impl.basic.Html;
import org.sparkle.html.impl.basic.Head.Meta;
import org.sparkle.html.impl.basic.Script;
import org.sparkle.html.impl.basic.Style;
import org.sparkle.html.impl.basic.TextArea;
import org.sparkle.html.impl.basic.Pre;
import org.sparkle.html.impl.js.engine.JavascriptEngine;
import org.sparkle.web.page.AbstractPage;
import org.sparkle.html.api.GroovyListener;
import org.sparkle.html.impl.basic.Span;

class Index extends AbstractPage {
	
	def run(JavascriptEngine jsEngine,CustomFormBean bean){		
		//jsEngine.show(toShow);
	}
	
	@Override
	public Object render() {
		
		Div masterRow=new Div();		
		masterRow.setClassStyle("row-fluid");
		
		Div container=new Div();
		container.setClassStyle("span12");
		
		masterRow.append(container);
		
		String s="import sparkle.api.html.impl.basic.Button;\nimport sparkle.api.html.impl.basic.Div;import sparkle.api.html.impl.basic.Form.CustomFormBean;import sparkle.api.html.impl.basic.Head;import sparkle.api.html.impl.basic.Head.DefaultScript;import sparkle.api.html.impl.basic.Html;import sparkle.api.html.impl.basic.Head.Meta;import sparkle.api.html.impl.basic.Script;import sparkle.api.html.impl.basic.Style;import sparkle.api.html.impl.basic.TextArea;import sparkle.api.html.impl.js.engine.JavascriptEngine;import sparkle.api.web.page.AbstractPage;import sparkle.api.html.api.GroovyListener;import sparkle.api.html.impl.basic.Span;class Index extends AbstractPage {def run(JavascriptEngine jsEngine,CustomFormBean bean){//jsEngine.show(toShow);}@Override public Object render() {Div masterRow=new Div();masterRow.setClassStyle(\"row-fluid\");Div container=new Div();container.setClassStyle(\"span12\");masterRow.append(container);TextArea ta=new TextArea(\"\");container.append(ta);container.append(new Script().setText(\"tinymce.init({selector: \"textarea\",theme: \"modern\", height: 500,plugins: [],toolbar: \"undo redo | outdent indent \",menubar : false});\"));return masterRow;}}"
		
		
		TextArea ta=new TextArea(s);
		ta.setId("editor");
		
		//container.append(ta);
		
		Pre p=new Pre();
		p.setId("editor");
		p.setText(s);
		p.css("height", "800px");
		container.append(p);
		
		//container.append(new Script().setText("tinymce.init({selector: \"textarea\",theme: \"modern\", height: 500,plugins: [\"code  bbcode save\"],toolbar: \"undo redo | outdent indent \",menubar : false});"));
		
		container.append(new Script().setText("var editor = ace.edit('editor');editor.setTheme('ace/theme/eclipse');editor.getSession().setMode('ace/mode/groovy');"));
		
		return masterRow;
		
	}
	
	

}